#include <bits/stdc++.h>
using namespace std;
const int N = 2000 + 10;
struct solver {
  int n;
  vector<int> G[N * 2], S;
  valarray<bool> mark;
  bool dfs(int x) {
    if (mark[x ^ 1]) return false;
    if (mark[x]) return true;
    mark[x] = true, S.push_back(x);
    for (auto v : G[x])
      if (!dfs(v)) return false;
    return true;
  }
  void init(int n) {
    mark.resize(N * 2);
    this->n = n;
    for (int i = 0; i < n * 2; ++i) G[i].clear(), mark[i] = false;
  }
  void add_clause(int x, int xval, int y, int yval) {
    x = x * 2 + xval, y = y * 2 + yval;
    G[x ^ 1].push_back(y), G[y ^ 1].push_back(x);
  }
  bool solve() {
    for (int i = 0; i < n * 2; i += 2)
      if (!mark[i] && !mark[i + 1]) {
        if (!dfs(i)) {
          while (!S.empty()) mark[S.back()] = false, S.pop_back();
          if (!dfs(i + 1)) return false;
        }
      }
    return true;
  }
} solver;

int n, T[N][2];
bool test(int diff) {
  solver.init(n);
  for (int i = 0; i < n; ++i)
    for (int a = 0; a < 2; ++a)
      for (int j = i + 1; j < n; ++j)
        for (int b = 0; b < 2; ++b)
          if (abs(T[i][a] - T[j][b]) < diff)
            solver.add_clause(i, a ^ 1, j, b ^ 1);
  return solver.solve();
}

int main() {
  while (scanf("%d", &n) == 1 && n) {
    int L = 0, R = 0;
    for (int i = 0; i < n; ++i)
      for (int a = 0; a < 2; ++a) {
        scanf("%d", &T[i][a]);
        R = max(R, T[i][a]);
      }
    while (L < R) {
      int M = L + (R - L + 1) / 2;
      if (test(M))
        L = M;
      else
        R = M - 1;
    }
    printf("%d\n", L);
  }
}
